package com.blazer.b;

public class array {
    public static void main(String[] args) {
        //动态初始化
        //数据类型[] 数组名=new 数据类型[长度]
        //数据类型 数组名[]=new 数据类型[长度]
        int[] arr1=new int[3];
        arr1[0]=100;
        arr1[1]=110;
        arr1[2]=200;

        String[] arr2=new String[3];
        arr2[0]="东方不败";
        arr2[1]="岳不群";
        arr2[2]="林平";
        System.out.println(arr1);
        System.out.println(arr2);
        //静态初始化
        //数据类型[] 数组名={元素1，元素2}
        int[] arr3=new int[]{1,2,3,4,6};
        System.out.println(arr3);
        //静态初始化简化
        int[] arr4={1,2,3,4,6};
        System.out.println(arr4);
        String[] arr5={"乾隆","何坤"};
        System.out.println(arr5);
        //数组长度
        int len=arr5.length;
        System.out.println("lem="+len);
    }
}
